.class Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddCalendarEvent;
.super Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEvent;
.source "AddCalendarEvent.java"

# interfaces
.implements Lcom/burstly/lib/util/calendar/CalendarEventsHandler$IEventsHandlerCallback;


# static fields
.field static final EVENT_ID:I = 0x8

.field private static final LOG:Lcom/burstly/lib/util/LoggerExt;

.field private static final TAG:Ljava/lang/String;


# instance fields
.field private mEventsHandler:Lcom/burstly/lib/util/calendar/CalendarEventsHandler;

.field private mView:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidView;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 39
    const-class v0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddCalendarEvent;

    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddCalendarEvent;->TAG:Ljava/lang/String;

    .line 44
    invoke-static {}, Lcom/burstly/lib/util/LoggerExt;->getInstance()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddCalendarEvent;->LOG:Lcom/burstly/lib/util/LoggerExt;

    return-void
.end method

.method constructor <init>()V
    .locals 0

    .prologue
    .line 29
    invoke-direct {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEvent;-><init>()V

    return-void
.end method


# virtual methods
.method public addedSuccessfully()V
    .locals 0

    .prologue
    .line 78
    return-void
.end method

.method protected cleanUp()V
    .locals 1

    .prologue
    const/4 v0, 0x0

    .line 88
    invoke-super {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEvent;->cleanUp()V

    .line 89
    iput-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddCalendarEvent;->mEventsHandler:Lcom/burstly/lib/util/calendar/CalendarEventsHandler;

    .line 90
    iput-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddCalendarEvent;->mView:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidView;

    .line 91
    return-void
.end method

.method public errorOccured(Ljava/lang/String;)V
    .locals 3
    .parameter "errorDescription"

    .prologue
    .line 82
    sget-object v0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddCalendarEvent;->LOG:Lcom/burstly/lib/util/LoggerExt;

    sget-object v1, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddCalendarEvent;->TAG:Ljava/lang/String;

    const/4 v2, 0x0

    new-array v2, v2, [Ljava/lang/Object;

    invoke-virtual {v0, v1, p1, v2}, Lcom/burstly/lib/util/LoggerExt;->logWarning(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 83
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddCalendarEvent;->mView:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidView;

    const-string v1, "createCalendarEvent"

    invoke-virtual {v0, v1, p1}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidView;->fireErrorEvent(Ljava/lang/String;Ljava/lang/String;)V

    .line 84
    return-void
.end method

.method fireEvent(Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidView;[Ljava/lang/Object;)V
    .locals 4
    .parameter "mraidView"
    .parameter "args"

    .prologue
    .line 58
    invoke-static {p2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddCalendarEvent;->checkArgs([Ljava/lang/Object;)Z

    move-result v2

    if-nez v2, :cond_0

    .line 72
    :goto_0
    return-void

    .line 61
    :cond_0
    iget-object v2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddCalendarEvent;->mEventsHandler:Lcom/burstly/lib/util/calendar/CalendarEventsHandler;

    if-nez v2, :cond_1

    .line 62
    new-instance v2, Lcom/burstly/lib/util/calendar/CalendarEventsHandler;

    invoke-virtual {p1}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidView;->getContext()Landroid/content/Context;

    move-result-object v3

    invoke-direct {v2, v3, p0}, Lcom/burstly/lib/util/calendar/CalendarEventsHandler;-><init>(Landroid/content/Context;Lcom/burstly/lib/util/calendar/CalendarEventsHandler$IEventsHandlerCallback;)V

    iput-object v2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddCalendarEvent;->mEventsHandler:Lcom/burstly/lib/util/calendar/CalendarEventsHandler;

    .line 64
    :cond_1
    const/4 v2, 0x0

    aget-object v1, p2, v2

    check-cast v1, Ljava/lang/String;

    .line 65
    .local v1, eventJson:Ljava/lang/String;
    const-class v2, Lcom/burstly/lib/util/calendar/CalendarEvent;

    invoke-static {v1, v2}, Lcom/burstly/lib/util/Utils;->fromJson(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/burstly/lib/util/calendar/CalendarEvent;

    .line 66
    .local v0, event:Lcom/burstly/lib/util/calendar/CalendarEvent;
    iput-object p1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddCalendarEvent;->mView:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidView;

    .line 67
    if-eqz v0, :cond_2

    iget-object v2, v0, Lcom/burstly/lib/util/calendar/CalendarEvent;->start:Ljava/lang/Long;

    if-eqz v2, :cond_2

    iget-object v2, v0, Lcom/burstly/lib/util/calendar/CalendarEvent;->description:Ljava/lang/String;

    if-eqz v2, :cond_2

    const-string v2, ""

    iget-object v3, v0, Lcom/burstly/lib/util/calendar/CalendarEvent;->description:Ljava/lang/String;

    invoke-virtual {v2, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_3

    .line 68
    :cond_2
    const-string v2, "Error parsing event. Check mandatory start and description fields."

    invoke-virtual {p0, v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddCalendarEvent;->errorOccured(Ljava/lang/String;)V

    goto :goto_0

    .line 70
    :cond_3
    iget-object v2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddCalendarEvent;->mEventsHandler:Lcom/burstly/lib/util/calendar/CalendarEventsHandler;

    invoke-virtual {v2, v0}, Lcom/burstly/lib/util/calendar/CalendarEventsHandler;->scheduleEvent(Lcom/burstly/lib/util/calendar/CalendarEvent;)V

    goto :goto_0
.end method
